import request from '@/utils/request'

export function getOrgTree(params) {
  return request({
    url: 'api/sys/org/getTree',
    method: 'get',
    params
  })
}

export function getOrgs(params) {
  return request({
    url: 'api/sys/org/page',
    method: 'get',
    params
  })
}

export function findAll(ids) {
  const data = ids instanceof Array ? ids : Array.of(ids)
  return request({
    url: 'api/sys/org/findAll',
    method: 'post',
    data
  })
}

export function add(data) {
  return request({
    url: 'api/sys/org/insert',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/sys/org/delete',
    method: 'post',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/sys/org/update',
    method: 'post',
    data
  })
}

export default { add, edit, del, getOrgTree, findAll, getOrgs }
